<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
		#d1{
			color: blue;
			font-size: 50px;
		}
		</style>
	</head>
	<body>
		<div id="d1"></div>
		<script>
			var time = new Date(2018,0,5,18,00,00);
			var timer;
			function f(){
				var now = new Date();
				var c = time.getTime() - now.getTime();
				if(c<0){
					clearInterval(timer);
					d1.innerHTML = "活动已经结束啦！";
					return;
				}
				var hour = Math.floor(c/(1000*60*60))%24;
				hour = hour < 10 ? "0" + hour:hour;
				var minute = Math.floor(c/(1000*60))%60;
				minute = minute < 10 ? "0" + minute:minute;
				var second = Math.floor(c/1000)%60;
				second = second < 10 ? "0" + second:second;
				var haomiao = Math.floor(c%1000);
				var day = Math.floor(c/(1000*60*60*24));
				if(day<1){
					d1.innerHTML = hour + "时" + minute + "分" + second + "秒" + haomiao + "毫秒";
				}else{
					d1.innerHTML = day + "天" + hour + "时" + minute + "分" + second + "秒" + haomiao + "毫秒";
				}
			}
			f();
			timer = setInterval(f,1)
		</script>
	</body>
</html>
